home *** CD-ROM | disk | FTP | other *** search
-
-
-
- DUP C Library Procedures DUP
-
-
-
- NNAAMMEE
- dup, dup2 - duplicate a descriptor
-
- SSYYNNOOPPSSIISS
- nneewwdd == dduupp((oolldddd))
- iinntt nneewwdd,, oolldddd;;
-
- dduupp22((oolldddd,, nneewwdd))
- iinntt oolldddd,, nneewwdd;;
-
- DDEESSCCRRIIPPTTIIOONN
- _D_u_p duplicates an existing object descriptor. The argument
- _o_l_d_d is a small non-negative integer index in the per-
- process descriptor table. The value must be less than the
- size of the table, which is returned by _g_e_t_d_t_a_b_l_e_s_i_z_e(2).
- The new descriptor returned by the call, _n_e_w_d, is the lowest
- numbered descriptor that is not currently in use by the pro-
- cess.
-
- The object referenced by the descriptor does not distinguish
- between references using _o_l_d_d and _n_e_w_d in any way. Thus if
- _n_e_w_d and _o_l_d_d are duplicate references to an open file,
- _r_e_a_d(2), _w_r_i_t_e(2) and _l_s_e_e_k(2) calls all move a single
- pointer into the file, and append mode, non-blocking I/O and
- asynchronous I/O options are shared between the references.
- If a separate pointer into the file is desired, a different
- object reference to the file must be obtained by issuing an
- additional _o_p_e_n(2) call. The close-on-exec flag on the new
- file descriptor is unset.
-
- In the second form of the call, the value of _n_e_w_d desired is
- specified. If this descriptor is already in use, the
- descriptor is first deallocated as if a _c_l_o_s_e(2) call had
- been done first.
-
- RREETTUURRNN VVAALLUUEE
- The value -1 is returned if an error occurs in either call.
- The external variable _e_r_r_n_o indicates the cause of the
- error.
-
- EERRRROORRSS
- _D_u_p and _d_u_p_2 fail if:
-
- [EBADF] _O_l_d_d or _n_e_w_d is not a valid active descriptor
-
- [EMFILE] Too many descriptors are active.
-
- SSEEEE AALLSSOO
- accept(2), open(2), close(2), fcntl(2), pipe(2), socket(2),
- socketpair(2), getdtablesize(2)
-
-
-
-
-
- Sprite v1.0 May 13, 1986 1
-
-
-
-